package cn.tedu.controller;

import cn.tedu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
//更新用户头像
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/loginRegister/head")
    public ResponseEntity head(MultipartFile headPhoto, Long id) throws IOException {
        //1、向user中设置用户id
        //3、调用service
        userService.updateHead(headPhoto,id);
        return ResponseEntity.ok(null);
    }
}


